package com.stlm2.dems.dao.impl;

import com.stlm2.dems.dao.GoodsCategoryDao;
import com.stlm2.dems.entity.GoodsCategory;
import org.springframework.stereotype.Repository;


import com.stlm2.core.base.impl.BaseDaoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("goodsCategoryDao")
public class GoodsCategoryDaoImpl extends BaseDaoImpl<GoodsCategory> implements GoodsCategoryDao {

    @Override
    public List<GoodsCategory> getByLevel(Integer goodsCategoryLevelValue) {
        return selectList("getByLevel",goodsCategoryLevelValue);
    }

    @Override
    public List<GoodsCategory> getByParentCategoryId(Integer parentCategoryId) {
        return selectList("getByParentCategoryId",parentCategoryId);
    }

    @Override
    public GoodsCategory getByNameAndParentCategoryId(String name, Integer parentCategoryId) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("name",name);
        map.put("parentCategoryId",parentCategoryId);
        return selectOne("getByNameAndParent",map);
    }


    @Override
    public GoodsCategory getByName(String name) {
        return selectOne("getByName",name);
    }


    @Override
    public List<GoodsCategory> getByTypeAndLevel(Integer categoryType, Integer goodsCategoryLevelValue) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("categoryType",categoryType);
        map.put("goodsCategoryLevelValue",goodsCategoryLevelValue);
        return selectList("getByTypeAndLevel",map);
    }


}